//
//  ZComposeButton.swift
//  swift-weibo
//
//  Created by zero on 17/3/28.
//  Copyright © 2017年 zero. All rights reserved.
//

import UIKit

class ZComposeButton: UIButton {

    override var isHighlighted: Bool{
        
        set{
            
        }
        
        get{
           
            return false
        }
        
        
    }
    
   
    
    //  模型属性
    var buttonModel:ZComposeModel?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
     
        //  布局
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        
        titleLabel?.textAlignment = .center
        titleLabel?.font = UIFont.systemFont(ofSize: 14)
        titleLabel?.textColor = UIColor.darkGray
        
        imageView?.contentMode = .center
    }
    
    //  重新布局
    override func layoutSubviews() {
        
        super.layoutSubviews()
        
        imageView?.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.width)
        
        titleLabel?.frame = CGRect(x: 0, y: self.bounds.size.width, width: self.bounds.size.width, height: self.bounds.size.height - self.bounds.size.width)
    }

}
